<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="box">aaa
      <strong>strong</strong><!--box下的子元素/子标签/子节点-->
      <span>span</span>
    </div>
    <script>
      var box = document.getElementsByClassName("box")[0];
      var strong = box.getElementsByTagName("strong")[0];
      //深度克隆
      var deepClone = box.cloneNode(true);
      document.body.appendChild(deepClone); //添加
      //浅克隆
      var shallowClone = box.cloneNode(false);
      document.body.appendChild(shallowClone);

      var deepClone1 = strong.cloneNode(true);
      console.log(deepClone1);
      deepClone.appendChild(deepClone1); //克隆一个strong节点添加到克隆后的box下面
      //document.body.appendChild(deepClone1)//添加到body下
    </script>
  </body>
</html>
